<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/content/mytags.jsp"%>
<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>角色列表</title>
		<t:resource types="jquery,lhgdialog,easyui" />
	</head>
	<body>
		<div id="role-list-layout" class="easyui-layout" data-options="fit:true">
			<div data-options="region:'center',border:false">
				<ui:datagrid name="roleList" idField="id" action="role.do?datagrid" title="角色列表">
					<ui:column field="id" title="编码" sortable="false" hidden="true" />
					<ui:column field="roleCode" title="角色编码" sortable="false" query="true" />
					<ui:column field="roleName" title="角色名称" sortable="false" query="true" />
					<ui:column field="opt" title="操作" align="center" />
					<ui:deleteOpt url="role.do?delete&id={id}" permiCode="system:role:delete" message="确定要删除角色[{roleCode}]吗？" title="删除角色" />
					<ui:funcOpt funname="setUsers({id},{roleCode},{roleName})" permiCode="system:usersinrole:view" title="用户管理" />
					<ui:funcOpt funname="setPermission({id},{roleCode},{roleName})" permiCode="system:permission:combotree:view" title="权限设置" />
					<ui:toolbar iconCls="add" title="新增角色" permiCode="system:role:save" url="role.do?addorupdate" funname="add" height="140px" />
					<ui:toolbar iconCls="edit" title="编辑角色" permiCode="system:role:save" url="role.do?addorupdate" funname="update" height="140px" />
				</ui:datagrid>
			</div>
			<div data-options="region:'east',split:true,collapsed:true,border:false,onExpand : function(){li_east = 1;},onCollapse : function() {li_east = 0;}" style="width: 660px;">
				<div id="setup-container-panel" class="easyui-panel" title="权限设置" data-options="fit:true,border:true">
					
				</div>
			</div>
		</div>
		<script type="text/javascript">
			function setUsers(id, roleCode, roleName) {
		        var title = '角色[' + roleCode + '][' + roleName + ']:当前的用户列表';
		        if(li_east == 0 || $('#role-list-layout').layout('panel','east').panel('options').title != title){
		            $('#role-list-layout').layout('expand','east');
		        }
		        $('#setup-container-panel').css('padding', '1px').panel({ 'title': title, 'href' : 'role.do?userList&roleId=' + id });
			}
			function setPermission(id, roleCode, roleName) {
		        var title = '角色[' + roleCode + '][' + roleName + ']:当前的权限设置';
		        if(li_east == 0 || $('#role-list-layout').layout('panel','east').panel('options').title != title){
		            $('#role-list-layout').layout('expand','east');
		        }
		        $('#setup-container-panel').css('padding', '10px').panel({ 'title': title, 'href' : 'role.do?setPermission&roleId=' + id });
			}
		</script>
	</body>
</html>